package tagrepository

import (
	"time"
	ds "zzxq/common/datasource"
	"zzxq/models"
)

type DbUserTag struct {

}

//获取用户自定义标签
func (tag *DbUserTag) GetUserTagList(uid int) []models.UserTag {
	var userTags []models.UserTag
	
	where := models.UserTag{Uid: uid}

	ds.GetDb().Where(where).Find(&userTags)

	return userTags
}

//创建用户自定义标签
func (tag *DbUserTag) CreateUserTag(uid int, title string) bool {
	userTags := models.UserTag{
		Uid: uid,
		Title: title,
		Status: 1,
		Ctime: time.Now().Format("2006-01-02 15:04:05"),
		Utime: time.Now().Format("2006-01-02 15:04:05"),
	}

	ds.GetDb().Create(&userTags)

	return true
}

